﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ALinq.BBS;
using ALinq.BBS.DataAccess;

namespace ALinq.BBS.Controllers
{
    partial class HomeController
    {
        public new ActionResult Member(string userName, int pageIndex)
        {
            ActionResult result = null;
            if (string.IsNullOrEmpty(userName))
                result = Authenticate();

            if (result == null)
            {
                var user = new Users().Single(o => o.Name == userName);
                this.ViewData["PostList"] = user.Posts.GetList(pageIndex);
                result = View(user);
            }
            return result;
        }
    }
}